<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=utf-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>摄影师<s:property value='#request.lpUser.realName'/></title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="摄影师,相册,来拍">
<meta http-equiv="description" content="分享">
<link href="css/share.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="jquery/download.js"></script>
<script type="text/javascript">
$(function(){
	var ids="<s:property value='#request.ids'/>";
	var userId="<s:property value='#request.lpUser.userId'/>";
	var count="<s:property value='#request.count' />";
	var ct="<s:property value='#request.lpUser.lpCity.cityName'/>";
	$(".cover").live("click",function(){
		var id=$(this).attr("id");
		window.location.href="cameraManAction_getpictures.action?galaryId="+id+"&userId="+userId;
	})
	$("#selectMore").click(function(){
		$("#selectMore").hide();
		$("#_loading").show();
		var agrs={ids:ids,userId:userId};
		setTimeout(function(){
		var index=false;
		$.ajax({
	         type : "post", 
	          url : "loadMoreGalary.action",
	          data : agrs,
	          async : false,
	          dataType:"json",
	          success : function(data){
	        	$("#_loading").hide();
	        	if(data.results.length==0){
	        		index=true;
	        	}
	  			$.each(data.results,function(index,item){
	  				var price="";
					ids=ids+item.galaryId+",";
					if(item.price!="0"){
						price="<div class='transparent_black' style='width:30%;top: 75%;height: 20%;'>"+
					     "</div>"+"<div class='transparent_black_show' style='width:30%;text-align: center;top: 75%;height: 20%;font-size:45px;'>"+
					     "<div style='padding:10px;'>￥"+item.price+"</div>";
					}
					$("#selectMore").before("<table><table class='t2' style='height:20%;' cellpadding='20' cellspacing='0'><tr><td>"+
					"<div class='showeel'>"+
				    "<div style='position:relative; width: 100%;height:auto;z-index:1;'><img class='cover' style='height:500px' id='"+item.galaryId+"'  src='"+item.galaryCover+"'/></div>"+
				      price+
				     "</div>"+
				     "</div>"+"</td></tr>"+
					"<tr><td align='left'><div class='big300' style='width:100%'><span>"+item.subjectName+"</span></div>"+
					"<div><span>"+ct+"."+item.styleName+".看过 "+item.viewNumber+" .评论 "+item.commentNumber+"</span></div>"
					+"</td></tr>"+"</table>");
				})
			}
	     })
	    var l=ids.split(",").length;
		if(index){
			$("#hideMore").show();
			$("#selectMore").hide();
			$("#_loading").hide();
		}else{
			$("#selectMore").show();
		} 
		},500);
	})
	
})

function DrawImage(ImgD){
var image=new Image();
var iwidth = 1600;            //定义允许图片宽度，当宽度大于这个值时等比例缩小
var iheight = 500;            //定义允许图片高度，当宽度大于这个值时等比例缩小
image.src=ImgD.src;
if(image.width>0 && image.height>0){         //假如图片长宽都不为零

     if(image.height/image.width>= iheight/iwidth){       //通过正弦值判断图片缩放后是否偏高
      if(image.height>iheight){        //如果图片比设定的要高
       ImgD.height=iheight;
       ImgD.width=(image.width*iheight)/image.height;
      }else{
       ImgD.width=image.width;
       ImgD.height=image.height;
      }
 
     ImgD.alt=image.width+"×"+image.height;
     }
 
     else{           //如果图片比例 小于 设定的比例
      if(image.width>iwidth){
       ImgD.width=iwidth;
       ImgD.height=(image.height*iwidth)/image.width;
      }else{
       ImgD.width=image.width;
       ImgD.height=image.height;
      }
     ImgD.alt=image.width+"×"+image.height;
     }
}
}
</script>
</head>
<body>
	<div class="body">
		<div class="top">
			<table border="0" class="t1">
				<tr>
					<td><img src="css/images/logo.png" style="margin-left:20px;" width="150" height="160"/></td>
					<td>
							<div><span class="big500">来拍</span></div>
							<div><span>移动互联网影像平台</span></div>
						</td>
					<td><input type="button" class="bt" value="立刻下载"></td>
				</tr>
			</table>
		</div>
		 <div class="middle" style="width:90%;padding-top:5%;">
			<table  class="t2">
				<tr>
					<td>
					<div style="wdith:100%;"><img src="<s:property value="#request.lpUser.headImage" />" class="image" /></div>
					<div style="wdith:100%;margin-top:20px;"><span class="big300">摄影师:<s:property value='#request.lpUser.realName'/></span></div>
					<div style="wdith:100%"><span><s:property value="#request.lpUser.lpCity.cityName" /></span></div>
					</td>
				</tr>
			</table>
			<table class="t2">
				<tr>
					<td align="left">
					风格:
					<s:iterator value="#request.lpUser.lpStyle" id="style" status="ls">
					<s:if test="#ls.last==true">
					<s:property value="#style.styleName"/>
					</s:if>
					<s:else>
					<s:property value="#style.styleName"/>、
					</s:else>
					</s:iterator>
					<br/>
					器材:<s:property value="#request.lpUser.grapherCarmer"/><br/>
					个人简介:<s:property value="#request.lpUser.grapherDesc"/>
					</td>
				</tr>
			</table>
			<!-- 一个作品集就使用一个table -->
			<s:iterator  value="#request.lpGalarys" id="lg" status="ls">
			<table class="t2" style="height:20%;" cellpadding="20" cellspacing="0">
			<s:if test="#ls.first==true">
				<tr>
					<td align="left" class="big300">
					作品集 10
					</td>
				</tr>
			</s:if>
				<tr>
		  <td>
			<div class="showeel">
		    <div style="position:relative; width: 100%;height:auto;z-index:1;"><img  style="height:500px" id="<s:property value="#lg.galaryId"/>" src="<s:property value="#lg.galaryCover"/>" onload="javascript:DrawImage(this)"/></div>
		     <s:if test="#lg.lpService.lpServiceDetail.price!=null&&#lg.lpService.lpServiceDetail.price>0">
		     <div class="transparent_black" style="width:30%;top: 75%;height:100px;float:left;left:0;">
		     </div>
		     <div class="transparent_black_show" style="width:30%;text-align: center;top: 75%;height:100px;font-size:45px;left:0;">
		     <div style="padding:10px;">￥<s:property value="#lg.lpService.lpServiceDetail.price" /></div>
		     </div>
		     </s:if>
		     </div>
				</td>
				</tr>
				<tr>
				<td  align="left">
				<div class="big300" style="width:100%"><span><s:property value="#lg.subjectName" /></span></div>
				<div><span><s:property value="#request.lpUser.lpCity.cityName"/>.
				<s:iterator id="ls" value="#lg.lpService.lpServiceDetail.lpStyle" status="status">
				<s:if test="#status.first==true">
				<s:property value="#ls.styleName" />
				</s:if>
				</s:iterator>
				.看过 <s:property value="#request.viewNumber"/> .评论 <s:property value="#request.commentNumber"/></span></div>
				</td>
				</tr>
			</table>
			</s:iterator>
		<s:if test="#request.count>#request.pageSize">
		<div class="middle"  id="selectMore"><a href="javascript:void(0)">查看更多作品</a></div>
		<div class="middle" style="display:none;" id="_loading"><img src="images/loading.gif" width="100" height="100"/></div>
		<div class="middle" style="display:none;" id="hideMore"><a href="javascript:void(0)" style="color:#857f7f">暂无更多作品</a></div>
		</s:if><s:else>
		<div class="middle" style="display: block;" id="hideMore"><a href="javascript:void(0)" style="color:#857f7f">暂无更多作品</a></div>
		</s:else>
		</div>
	</div>
</body>
</html>
